import { UploadUtils } from "./TCDNUploadFlowPorts";
import { Time } from "./time";
import { UploadAbility } from "./uploadHZYX";
import { WechatCI } from "./wechatCompile";

export class UploadTool {
    //上传指定路径文件 并 通知到popo打包群
    //filepath 文件路径
    //notifyStr 要通知的话
    public static async uploadFileWithNotify(filePath: string, notifyStr: string = "") {
        console.log(process.cwd())
        console.log("uploadFile ##" + filePath)

        let packName = Time.getTodayDate();

        UploadAbility.setUploadDefaultConfig();
        UploadUtils.uploadSingleFile(filePath, `${packName}.zip`)
            .then((downloadUrl: string) => {
                WechatCI.robotMsg(WechatCI.DEFAULT_GROUP_ID, notifyStr + downloadUrl)
            })
            .catch((e => {
                console.log(e)
            }));
    }
}